package com.ibeeking.found.org.cp.rest.controller.v1;

import com.ibeeking.found.org.cp.rest.service.IEmployeeFieldService;
import com.ibeeking.found.org.cp.rest.service.IEmployeeFieldService;
import com.ibeeking.found.org.cp.rest.service.IEmployeeService;
import com.ibeeking.found.org.service.common.param.EmployeeExtendFieldParam;
import com.ibeeking.found.org.service.common.vo.EmployeeFieldVO;
import com.ibeeking.nematos.constants.enums.OperateLogTypeEnum;
import com.ibeeking.nematos.log.annotation.Log;
import com.ibeeking.nematos.utils.base.BaseValidationGroup;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName MemberInfoFieldController控制器
 * @Description
 * @Author ibeeking
 * @Date 2022-01-24 11:39
 **/
@RestController
@RequestMapping("/cp/extendField/v1")
public class EmployeeFieldController {

    @Resource
    private IEmployeeFieldService fieldServiceImpl;

    @Resource
    private IEmployeeService employeeService;

    @Log(logType = OperateLogTypeEnum.QUERY, describe = "员工扩展资料查询")
    @GetMapping(value = "/list/{id}")
    public List<EmployeeFieldVO> pageList(@PathVariable("id") Long id) {
        return fieldServiceImpl.fieldListQuery(id);
    }

    @Log(logType = OperateLogTypeEnum.QUERY, describe = "员工扩展资料信息更新")
    @PostMapping(value = "/modify")
    public Boolean modify(@RequestBody @Validated(BaseValidationGroup.Update.class) EmployeeExtendFieldParam param) {
        return employeeService.updateEmployeeExtendField(param);
    }
}
